AC_INIT([logicopt], [0.1])
AM_INIT_AUTOMAKE([-Wall no-dependencies dist-bzip2])

AC_LANG_CPLUSPLUS
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
#AC_PROG_RANLIB

AC_ARG_ENABLE(debug,
              [  --enable-debug=debuglevel   Enable debug output in library ],
              [ if test "$enableval" = "no"; then
               debuglevel=0
             else
               debuglevel=$enableval
             fi
             ],
             [debuglevel=0])

AC_SUBST(debuglevel)

AC_ARG_WITH(libmetasearch,
            AC_HELP_STRING([--with-libmetasearch[=PATH]],[Path to libmetasearch files]),
            [
             if test $withval != "yes"; then
               if test -f $withval/include/eda.h; then
                 AC_SUBST(metasearchdir, [$withval])
                 LDFLAGS="$LDFLAGS -L$withval/lib -lmetasearch"
                 CPPFLAGS="$CPPFLAGS -I$withval/include"
               else
                 AC_MSG_ERROR([libmetasearch not found])
               fi
             else
               AC_SUBST(metasearchdir, [.])
             fi
            ])

#AC_CHECK_LIB([metasearch],
#             [classGenerateFromBufferR9edaBuffer],
#             [],
#             [
#               AC_MSG_ERROR([This program needs libmetasearch], 1)
#             ])

AC_CONFIG_FILES([
                 Makefile
                 scripts/Makefile
                 src/Makefile
                 ])

AC_OUTPUT
